const { MongoClient } = require('mongodb')
const { mongodbUrl, mongoDbName } = require('../../config/db')

const mongo = async () => {
  const client = new MongoClient(mongodbUrl)
  await client.connect()
  console.log('Connected successfully to server')
  return client.db(mongoDbName)
}

module.exports = mongo
